Title Banner


Technical Q&A's


DV 26 - Calling ataManager on a Power Macintosh (31-Jan-97)


Q We're working on drivers for the ATA bus in Power Macintosh computers. However, we can't seem to find the link libraries on our ETO disks. The header libraries are there, but there is nothing to link to.

A There is no library to link to, at least if you are writing 68K code. If you wish to use the ATA manager on Power Macintoshes, you need to supply some Mixed Mode glue to call ataManager. The following should do:
#include <MixedMode.h>
#include <ATA.h>

#define RESULT_OFFSET(type) ((sizeof(type) == 1) ? 3 : ((sizeof(type) == 2)
? 1 : 0))
#define TBTrapTableAddress(trapNum) (((trapNum & 0x03FF) << 2) + 0xE00)

pascal SInt16 ataManager(ataPB *pb)
{
    #ifdef applec
        #if sizeof(SInt16) > 4
            #error "Result types larger than 4 bytes are not supported."
        #endif
    #endif
    long    private_result;

    private_result =
CallUniversalProc(*(UniversalProcPtr*)TBTrapTableAddress(0xAAF1),
        kPascalStackBased
         | RESULT_SIZE(SIZE_CODE(sizeof(SInt16)))
         | STACK_ROUTINE_PARAMETER(1, SIZE_CODE(sizeof(pb))),
        pb);
    return *(((SInt16*)&private_result) + RESULT_OFFSET(SInt16));
}


--Vinnie Moscaritolo
devsupport@apple.com

Technical Support
Technical Q&As
Previous Question | Contents | Next Question

Navigation graphic, see text links

Main | Top of Section | What's New | Apple Computer, Inc. | Find It | Feedback | Help